<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>order page</title>

<script src="../../resources/js/jquery/jquery-1.11.3.min.js"></script>
</head>
<body>
	<form id="f1" action="#" method="post">
		<table>
			<tr>
				<td>订单提交路径:</td>
				<td><input type="text" name="submitUrl" id="actionUrl"
					style="width: 400px" value="http://localhost:8080/pay/guide" /></td>
			</tr>
			<tr>
				<td>版本号 version:</td>
				<td><input type="text" name="version" value="v1.0" /></td>
			</tr>
			<tr>
				<td>渠道 channel:</td>
				<td><select name="channel" onchange="init()">
						<option value="0900">连连</option>
						<option value="1900" selected="selected">快钱</option>
				</select></td>
			</tr>
			<tr>
				<td>支付类型 payType:</td>
				<td><select name="payType" onchange="init()">
						<option value="0">认证支付</option>
						<option value="1">网银支付</option>
				</select></td>
			</tr>
			<tr>
				<td>商户号 merchantId:</td>
				<td><input type="text" name="merchantId"
					value="812051545110011" /></td>
			</tr>
			<tr>
				<td>商户名称 merchantName:</td>
				<td><input type="text" name="merchantName" value="xxx商户" /></td>
			</tr>
			<tr>
				<td>业务ID accessId:</td>
				<td><input type="text" name="accessId" value="FRONT" /></td>
			</tr>
			<tr>
				<td>请求时间 reqTime:</td>
				<td><input type="text" name="reqTime" value="201608191852" /></td>
			</tr>
			<tr>
				<td>签名方式 signType:</td>
				<td><select name="signType">
						<option value="md5">md5</option>
						<option value="rsa">rsa</option>
				</select></td>
			</tr>
			<tr>
				<td>签名值 sign:</td>
				<td><input type="text" name="sign" value="20160819" /></td>
			</tr>

			<tr>
				<td>业务订单号 orderNo:</td>
				<td><input type="text" name="orderNo" value="123456" /></td>
			</tr>
			<tr>
				<td>业务订时间 orderTime:</td>
				<td><input type="text" name="orderTime" value="201608192052" /></td>
			</tr>
			<tr>
				<td>业务名 orderName:</td>
				<td><input type="text" name="orderName" value="" /></td>
			</tr>
			<tr>
				<td>订单扩展信息 orderInfo:</td>
				<td><input type="text" name="orderInfo"
					value="支付限额 （元）单笔限额： xxxxx每日限额： xxxxx每月限额： xxxxx" /></td>
			</tr>
			<tr>
				<td>商品名 orderGoods:</td>
				<td><input type="text" name="orderGoods" value="YY-A2016082401" /></td>
			</tr>

			<tr>
				<td>过期时间 expireTime:</td>
				<td><input type="text" name="expireTime" value="201608201252" /></td>
			</tr>
			<tr>
				<td>金额 amount:</td>
				<td><input type="text" name="amount" value="5000" />单位：分</td>
			</tr>
			<tr>
				<td>币种 currency:</td>
				<td><select name="currency">
						<option value="1">人民币</option>
						<option value="2">美元</option>
				</select></td>
			</tr>
			<tr>
				<td>异步回调地址 notifyUrl:</td>
				<td><input type="text" name="notifyUrl" style="width: 400px"
					value="http://localhost/pay/guide" />用于通知业务模块</td>
			</tr>
			<tr>
				<td>页面跳转地址 backUrl:</td>
				<td><input type="text" name="backUrl" style="width: 400px"
					value="http://www.yyfax.com/" /></td>
			</tr>
			<tr>
				<td>订单详情地址 orderUrl:</td>
				<td><input type="text" name="orderUrl" style="width: 400px"
					value="https://www.yyfax.com/financing/yxlc/yxxq/6388.html" /></td>
			</tr>
			<tr>
				<td>银行机构代码 bankCode:</td>
				<td><select name="bankCode" onchange="init()">
						<option value="03100000">上海浦东发展银行</option>
						<option value="01040000">中国银行</option>
				</select> <input type="hidden" name="bankName" /></td>
			</tr>
			<tr>
				<td>银行卡号 cardNo:</td>
				<td><input type="text" name="cardNo" value="6214836552343853" /></td>
			</tr>
			<tr>
			<tr>
				<td>银行卡绑定手机 cardPhone:</td>
				<td><input type="text" name="cardPhone" value="13480670943" /></td>
			</tr>
			<tr>
				<td>用户id userId:</td>
				<td><input type="text" name="userId" value="66" /></td>
			</tr>
			<tr>
				<td>用户手机号 userPhone:</td>
				<td><input type="text" name="userPhone" value="15260828805" /></td>
			</tr>
			<tr>
				<td>真实姓名 realName:</td>
				<td><input type="text" name="realName" value="大辉哥" /></td>
			</tr>
			<tr>
				<td>登录名 loginName:</td>
				<td><input type="text" name="loginName" value="小辉哥" /></td>
			</tr>
			<tr>
				<td>证件类型 idType:</td>
				<td><select name="idType">
						<option value="0">身份证</option>
						<option value="1">户口簿</option>
				</select></td>
			</tr>
			<tr>
				<td>证件号码 idNo:</td>
				<td><input type="text" name="idNo" value="350322199008122555" /></td>
			</tr>
			<tr>
				<td>二次支付标识 agreeNo:</td>
				<td><select name="agreeNo">
						<option value="0">首次</option>
						<option value="1">再次</option>
				</select></td>
			</tr>
			<tr>
				<td>用户IP reqIp:</td>
				<td><input type="text" name="reqIp" value="127.0.0.1" /></td>
			</tr>

			<tr>
				<td>用户注册时间 userRegTime:</td>
				<td><input type="text" name="userRegTime"
					value="20160815121232" /></td>
			</tr>

			<tr>
				<td>终端来源 platform:</td>
				<td><select name="platform">
						<option value="PC">PC端</option>
						<option value="H5">移动端</option>
						<option value="APP">APP</option>
				</select></td>
			</tr>

			<tr>
				<td><input type="submit" value="提交" /></td>
			</tr>
		</table>
	</form>
	<script type="text/javascript">
		Date.prototype.format = function(format){ 
			var o = { 
			"M+" : this.getMonth()+1, // month
			"d+" : this.getDate(), // day
			"h+" : this.getHours(), // hour
			"m+" : this.getMinutes(), // minute
			"s+" : this.getSeconds(), // second
			"q+" : Math.floor((this.getMonth()+3)/3), // quarter
			"S" : this.getMilliseconds() // millisecond
			} 
			 
			if(/(y+)/.test(format)) { 
			format = format.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length)); 
			} 
			 
			for(var k in o) { 
			if(new RegExp("("+ k +")").test(format)) { 
			format = format.replace(RegExp.$1, RegExp.$1.length==1 ? o[k] : ("00"+ o[k]).substr((""+ o[k]).length)); 
			} 
			} 
			return format; 
		}
		
	$(document).ready(function() {
		init();
	});
	function init(){
		
		var channelIndex = f1.channel.selectedIndex;
		var channelValue = f1.channel.options[channelIndex].value;
		if(channelValue == "1900"){
			f1.merchantId.value = "812051545110011"; 
			f1.merchantName.value = "快钱商户";
		}else{
			f1.merchantId.value = "201103171000000000"; 
			f1.merchantName.value = "连连商户";
		}
		
		f1.submitUrl.value = 'http://'+window.location.host+'/pay/guide';
		//f1.notifyUrl.value = 'http://'+window.location.host+'/pay/api/notify_' + f1.channel.value;
		f1.notifyUrl.value = 'http://'+window.location.host+'/busi/api/notify_' + f1.channel.value;
		//f1.backUrl.value = 'http://'+window.location.host+'/pay/result_' + f1.channel.value;
		f1.orderGoods.value = 'YY-A'+parseInt(new Date().format('yyyyMMddss'));
		f1.orderNo.value = new Date().getTime();
		f1.orderTime.value = parseInt(new Date().format('yyyyMMddhhmmss'))-10;
		f1.reqTime.value = parseInt(new Date().format('yyyyMMddhhmmss'));
		f1.expireTime.value = parseInt(new Date().format('yyyyMMddhhmmss'))+3000;
		f1.orderName.value =  $(f1.payType).find("option:selected").text();
		f1.bankName.value = $(f1.bankCode).find("option:selected").text();
	}
	function sign(){
		// 提交form参数,获取返回的sign值; 这里可用于业务开发校验签名算法
		
	}
	$("#f1").submit(function(){
	  var actionUrl = $("#actionUrl").val();
	  this.setAttribute("action",actionUrl);
	});
	</script>
</body>
</html>